--[[
* 传递伤害]]
BuffEffect23 = ClientFight.CreateClass("BuffEffect23", ClientFight.BaseBuffEffect)

---@class BuffEffect23 : BaseBuffEffect
local t = BuffEffect23

---@param fight Fight
---@param buff FighterBuff
function t:action(fight, buff, ...)
    local parameters = {...};
    if (isDamageActionTrigger(buff)) then
        -- buff触发的伤害不会触发此效果
        local isBuff = parameters[4];
        if (isBuff) then
            return IBuffEffect.FAIL;
        end
    end
    local fighter = buff.target;
    local trigger = parameters[1];
    local skill = parameters[2];
    local result = parameters[3];

    -- 找到所有拥有该标记的队友
    local targets = {};
    local fightTeam = fight.teams[fighter.teamIndex];
    for k, _fighter in pairs(fightTeam.fighters) do
        if (_fighter:isDie()) then
            goto continue;
        end
        if (fighter.fighterId ~= _fighter.fighterId and table.contains(_fighter.totalSign.signs, buff.buffBean.f_BuffEffectValue[2])) then
            table.insert(targets, _fighter);
        end
        :: continue ::
    end

    for k, _fighter in pairs(targets) do
        local _result = FightResult.New();
        _result.state = DamageResultTypeEnum.NORMAL;
        _result.damage = result.damage * buff.buffBean.f_BuffEffectValue[3] / Global.TEN_THOUSANDTH;
        SkillRoleMgr.savePathFile("[" .. fight.frame .. "][EFFECT]Fighter " .. buff.target.fighterId .. " Buff:"
                .. buff.modelId .. " 触发传递伤害给：" .. _fighter.fighterId .. ",传递伤害:" + _result.damage);
        DamageManager.realDamage(fight, trigger, _fighter, buff.modelId, _result, skill.skill.skillBean.f_HurtMethod);
    end
    return ClientFight.BaseBuffEffect.action(self, fight, buff, parameters);
end

t.New()